import type { FC } from 'react';
import { Text, TouchableOpacity } from 'react-native';
import { useDetails } from '../hooks';
import styles from './styles';

type RichTextProps = {
  onClick?: () => void;
  numberOfLines?: number;
}

const RichText: FC<RichTextProps> = (props) => {
  const { title } = useDetails();

  return (
    <TouchableOpacity
      activeOpacity={.9}
      style={styles.wrapper}
      onPress={props.onClick}
    >
      <Text
        style={styles.text}
        numberOfLines={props.numberOfLines}
      >
        {title}
      </Text>
    </TouchableOpacity>
  );
}

export default RichText;